I'm writing apache rewrite rules as below (in fact it is hard to understand rewrite syntax)
RewriteRule /res/([^/.]+)/([^/.*]+) /$2?res=$1 [QSA]
The result look weird and i can't find a way to make it correct.
Try 1: http://aaa.com/product/res/aa-bb-cc/json.php
Output 1: http://aaa.com/product/json?res=aa-bb-cc.php
Expected 1: http://aaa.com/product/json.php?res=aa-bb-cc
Try 2: http://aaa.com/product/res/aa-bb-cc/m/s/qt.php?action=edit&record_id=123
Output 2: http://aaa.com/product/m?res=aa-bb-cc/s/qt.php&action=edit&record_id=123
Expected 1: http://aaa.com/product/m?/s/qt.php?action=edit&record_id=123&res=aa-bb-cc
Any help will be greatly appreciated and thanks in advance.